package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.service.SentinelService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 课工场
 * @date 2025/1/15
 * @description
 */
@RestController
@RequestMapping("sentinel")
public class SentinelController {


    @Resource
    private SentinelService sentinelService;

    @GetMapping("m1")
    public String method1(){
        long time = System.currentTimeMillis();
        System.out.println(time+"处理了换一个请求");
        return  "SentinelController method1 ok";
    }


    @GetMapping("m2")
    public String method2(){
        sentinelService.method1();
        return  "SentinelController method2 ok";
    }


    @GetMapping("m3")
    public String method3(Integer id){

        if (id<0){
            throw  new RuntimeException("参数异常");
        }

        return  "SentinelController method3 ok";
    }
}
